package com.jeeinc.oa.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.jeeinc.oa.domain.Portlet;
import com.jeeinc.oa.model.Pager;
import com.jeeinc.oa.service.IPortletService;

@Controller
@RequestMapping(value = "/portlet/")
public class PortletController {
	@Resource
	private IPortletService portletService;

	@RequestMapping(value = "save")
	public String save(Model model, Portlet portlet) {
		portletService.savePortlet(portlet);
		model.addAttribute("message", "新增Banner成功");
		return "redirect:list";
	}

	@RequestMapping(value = "list")
	public void list(Model model, Pager pager) {
		model.addAttribute("pager", portletService.getPortlets(pager));
	}
}
